<?php
/**
 * Repository trida s rozsirujicimi selecty pro entitu User.
 * 
 * @author David Dusek 
 */

namespace CMS\User\Models;

use Doctrine\ORM\EntityRepository;

class UserRepository extends EntityRepository {
    
    /**
     * Vyber uzivatelu kteri nejsou ve skupine se zadanym id.
     * @param int $groupId
     * @return array 
     */
    public function usersNotInGroup($groupId) {        
        $qb = $this->_em->createQueryBuilder();
        $qb = $qb->select('u')
                 ->from("\CMS\User\Models\User", 'u')
                 ->where("u.group != $groupId");
        return $qb->getQuery()->getResult();
    }
}
